﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace theguineasyndrome.editor
{
    public class PointMark : Mark
    {
        private Vector2 position;

        public float X
        {
            get { return position.X; }
        }

        public float Y
        {
            get { return position.Y; }
        }

        public PointMark(Texture2D texture, SpriteFont spriteFont, Vector2 position)
            : base(texture, spriteFont)
        {
            this.position = position;
        }

        public Vector2 getPosition()
        {
            return position;
        }

        public override void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            if (camera.isVisible(new Rectangle((int)(position.X - texture.Width / 2), (int)(position.Y - texture.Height / 2), texture.Width, texture.Height)))
            {
                spriteBatch.Draw(texture, camera.getDstPoint(position - new Vector2(texture.Width, texture.Height) / 2), Color.White);
                if (name != "")
                {
                    Vector2 size = spriteFont.MeasureString(name);
                    size.X *= -1;
                    spriteBatch.DrawString(spriteFont, name, camera.getDstPoint(position + size / 2), Color.Black);
                }
            }
        }

    }
}
